<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/common/backcommon.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Breaking Fast</title>
		<script type="text/javascript">
			$(function() {
				$.ajax({
					url: "${base}/backComboCtl/selectcombolist",
					type: "post",
					success: function(result){
						var comboSelectList = $('select');
						var comboId = ["${weekmenuComboList[0].combo.comboid}", 
							"${weekmenuComboList[1].combo.comboid}", 
							"${weekmenuComboList[2].combo.comboid}", 
							"${weekmenuComboList[3].combo.comboid}", 
							"${weekmenuComboList[4].combo.comboid}"];
						for(var i = 0; i < comboSelectList.length; i++) {
							for(var j = 0; j < result.length; j++) {
								var checked = comboId[i] == result[j].comboid ? "selected" : "";
								$(comboSelectList[i]).append("<option value='" + result[j].comboid + "' " + checked + ">" + result[j].combochname + "</option>");
							}
						}
					}
				});
				//验证信息
				$.formValidator.initConfig({
					formID: "addForm",
					debug:false,
					onError: function(msg, obj, errorlist){
					alert(msg);
					}
				});
				
				$("#sellweek").formValidator({onShow:"请选择销售日期", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, onError:"请选择销售日期"});
				$("#price").formValidator({onShow: "请输入数字", onCorrect: "恭喜你,你输对了"}).inputValidator({min:0.1, max:9999, onError:"单价在0-9999之间"}).inputValidator({min:0, max:9999, type:"value", onErrorMin:"你输入的值必须大于等于0", onError:"单价必须在0-9999之间，请确认"});
				$("#comboList1").formValidator({onShow:"请选择套餐", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, onError:"请选择套餐"});
				$("#comboList2").formValidator({onShow:"请选择套餐", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, onError:"请选择套餐"});
				$("#comboList3").formValidator({onShow:"请选择套餐", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, onError:"请选择套餐"});
				$("#comboList4").formValidator({onShow:"请选择套餐", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, onError:"请选择套餐"});
				$("#comboList5").formValidator({onShow:"请选择套餐", onCorrect:"恭喜你,你输对了"}).inputValidator({min:1, onError:"请选择套餐"});
				$("#remark").formValidator({empty:true, onShow:"请输入备注信息", onCorrect:"恭喜你,你输对了"}).inputValidator({max:500, onError:"你输入的备注信息太长"}).regexValidator({regExp: "Illegal", dataType:"enum", onError:"备注信息中包含非法字符"});
			});
		</script>
	</head>
	<body>
		<div class="cms_right">
		  	<div class="cms_title">
		    	<span>菜单管理：${weekMenu.weekmenuid == null ? "新增" : "修改"} </span>
		    </div>
		    <div class="cms_search">
		    	<form:form id="addForm" commandName="weekMenu" action="${base}/backWeekMenuCtl/operate" method="post">
					<table width="1000" border="0" class="search_bd">
			          	<tr>
				            <td class="yh_name">销售日期：</td>
				            <td class="yh_bd"><input type="text" class="Wdate" id="sellweek" name="sellweek" style="cursor: pointer" onFocus="WdatePicker({readOnly:true,isShowWeek:true,disabledDays:[2,3,4,5,6,0]})" value="${weekMenu.sellweekStr}" /></td>
				            <td class="tishi"><div id="sellweekTip" ></div></td>
				            <td class="yh_name">单价：</td>
				            <td class="yh_bd"><input type="text" id="price" name="price" class="cms_text02" value="${weekMenu.price}" /></td>
				            <td class="tishi"><div id="priceTip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">周一套餐：</td>
				            <td class="yh_bd">
				            	<select id="comboList1" name="comboId1">
					            	<option value="" selected="selected">=请选择=</option>
				            	</select>
			            	</td>
				            <td class="tishi"><div id="comboList1Tip"></div></td>
				            <td class="yh_name">周二套餐：</td>
				            <td class="yh_bd">
				            	<select id="comboList2" name="comboId2">
					            	<option value="" selected="selected">=请选择=</option>
				            	</select>
			            	</td>
				            <td class="tishi"><div id="comboList2Tip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">周三套餐：</td>
				            <td class="yh_bd">
				            	<select id="comboList3" name="comboId3">
					            	<option value="" selected="selected">=请选择=</option>
				            	</select>
			            	</td>
				            <td class="tishi"><div id="comboList3Tip"></div></td>
				            <td class="yh_name">周四套餐：</td>
				            <td class="yh_bd">
				            	<select id="comboList4" name="comboId4">
					            	<option value="" selected="selected">=请选择=</option>
				            	</select>
			            	</td>
				            <td class="tishi"><div id="comboList4Tip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">周五套餐：</td>
				            <td class="yh_bd">
				            	<select id="comboList5" name="comboId5">
					            	<option value="" selected="selected">=请选择=</option>
				            	</select>
			            	</td>
				            <td class="tishi"><div id="comboList5Tip"></div></td>
			          	</tr>
			          	<tr>
				            <td class="yh_name">备注：</td>
				            <td class="yh_bd" colspan="4">
				            	<textarea id="remark" name="remark" rows="3" cols="100" style="border:1px solid #a0a0a0;resize:none">${weekMenu.remark}</textarea>
				            <td class="tishi"><div id="remarkTip"></div></td>
			          	</tr>
			          	<tr>
				            <td>&nbsp;</td>
				            <td align="right"><input type="reset" id="resetBtn" class="search_btn" value="重置" /></td>
				            <td align="center"><input type="button" class="search_btn" onclick="location.href='${base}/background/weekmenu/weekmenulist.jsp'" value="返回" /></td>
				            <td><input type="submit" class="search_btn" value="确定" /></td>
				            <td>&nbsp;</td>
				            <td>
				            	<input type="hidden" name="weekmenuid" value="${weekMenu.weekmenuid }" />
				            </td>
						</tr>
					</table>
				</form:form>
			</div>
		</div>
	</body>
</html>
	